Call Functions

  • Hi Everybody,
  • I would like doing like in C for the functions but I don't know if it's possible to do. I'll explain you.
  • In C we can include several C "files", after that, it's possible to use each functions inside those C "files".
  • Example : #include<file.h>, in "file.h", you have the function void test (string p);
  • In my main function I use test("Blabla") and it works.
  •  
  • I would want if it's possible to do the same thing in DXL langage ?
  • I did several research but I did'nt get anything. I tried a lot of things but with no results...
  •  
  • Thanks you for you help in advance.
  • Adrien

andrad - Thu Nov 13 09:12:34 EST 2014

Re: Call Functions
Mathias Mamsch - Thu Nov 13 11:27:32 EST 2014

Of course you can include files by doing:

#include <file.dxl>

For this you need to know about the include search path of DOORS (in the manual and in the forum you will find some information on that).

Then the difference between C and DXL is, that C compiles in two steps: 'compile' and 'link'. At compile time, the c compiler does only care about the current file, therefore you pass him .h files containing only function declararations (but no code) to tell him which other functions are available in the files you are going to link with.

In DXL the parsing is simply top down, meaning before you use a function it must be declared with full code. There is however a thing in DXL that is called 'forward declaration' (see manual / forum). But you should'nt use this, except you have to, because this feature can lead to crashes under certain circumstances ...

When you worry about how to structure a library, there have also been several posts on the forum. One discussion recently:

https://www.ibm.com/developerworks/community/forums/html/topic?id=7267362c-7f25-4eb1-9056-46809a3bed0d&ps=25

Hope that helps, regards, Mathias

Re: Call Functions
andrad - Fri Nov 14 04:20:32 EST 2014

Mathias Mamsch - Thu Nov 13 11:27:32 EST 2014

Of course you can include files by doing:

#include <file.dxl>

For this you need to know about the include search path of DOORS (in the manual and in the forum you will find some information on that).

Then the difference between C and DXL is, that C compiles in two steps: 'compile' and 'link'. At compile time, the c compiler does only care about the current file, therefore you pass him .h files containing only function declararations (but no code) to tell him which other functions are available in the files you are going to link with.

In DXL the parsing is simply top down, meaning before you use a function it must be declared with full code. There is however a thing in DXL that is called 'forward declaration' (see manual / forum). But you should'nt use this, except you have to, because this feature can lead to crashes under certain circumstances ...

When you worry about how to structure a library, there have also been several posts on the forum. One discussion recently:

https://www.ibm.com/developerworks/community/forums/html/topic?id=7267362c-7f25-4eb1-9056-46809a3bed0d&ps=25

Hope that helps, regards, Mathias

Thank you Mathias,

I have got to use a function. I included a .dxl file... and it's not a library. I didn't know that a .inc was a library file. Thank to your answer I'm not blocked now.

Adrien